<%
Function PostHttpPage(PostUrl,PostData) 
    Dim xmlHttp 
    Dim RetStr      
    Set xmlHttp = CreateObject("Msxml2.ServerXMLHTTP")  
    xmlHttp.Open "POST", PostUrl, False
    XmlHTTP.setRequestHeader "Content-Length", Len(PostData) 
    xmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded;charset=UTF-8"
    xmlHttp.Send PostData
    If Err.Number <> 0 Then 
        Set xmlHttp=Nothing
        PostHttpPage = "$False$"
        Exit Function
    End If
    PostHttpPage=bytesToBSTR2(xmlHttp.responseBody,"utf-8")
    Set xmlHttp = nothing
End Function

Function BytesToBstr2(strBody,CodeBase)
       dim obj
       set obj=Server.CreateObject("Adodb.Stream")
       obj.Type=1
       obj.Mode=3
       obj.Open
       obj.Write strBody
       obj.Position=0
       obj.Type=2
       obj.Charset=CodeBase
       BytesToBstr2=obj.ReadText
       obj.Close
       set obj=nothing
End Function

Function getDate(var_date,var_format)
  if var_format="yyyy-mm-dd" then
   var_year=year(var_date)
   var_month=month(var_date)
   var_day=day(var_date)
   if (var_month>=0 and var_month<=9) then
      var_month="0"&var_month  
   end if 
  
   if (var_day>=0 and var_day<=9) then
       var_day="0"&var_day
   end if 
    str_date=var_year&"-"&var_month&"-"&var_day
        getDate=str_date
  
  end if
End Function

Function getTime(var_time,var_format)
  if var_format="hh:mm:ss" then
    var_hour=hour(time)
        var_minute=minute(time)
        var_second=second (time)
        
        if (var_hour>=0 and var_hour<=9) then
             var_hour="0"&var_hour
        end if 
        
        if (var_minute>=0 and var_minute<=9) then
             var_minute="0"&var_minute
        end if 
        
        if (var_second>=0 and var_second<=9) then
             var_second="0"&var_second
        end if
        
        str_time=var_hour&":"&var_minute&":"&var_second
    getTime=str_time
  end if

End Function





Function getHTTPPage(url) 
dim objXML 
set objXML=createobject("Msxml2.XMLHTTP")'定义   MSXML2.XMLHTTP
objXML.open "GET",url,false'打开 
objXML.send()'发送 
If objXML.readystate<>4 then '判断文档是否已经解析完，以做客户端接受返回消息
exit function 
End If 
getHTTPPage=bBytesToBstr(objXML.responseBody)'返回信息，同时用函数定义编码 
set objXML=nothing'关闭 
if err.number<>0 then err.Clear 
End Function 
Function Newstring(wstr,strng) 
Newstring=Instr(lcase(wstr),lcase(strng)) 
if Newstring<=0 then Newstring=Len(wstr) 
End Function 
Function bBytesToBstr(body) 
dim objstream 
set objstream = CreateObject("adodb.stream") 
objstream.Type = 1 
objstream.Mode =3 
objstream.Open 
objstream.Write body 
objstream.Position = 0 
objstream.Type = 2 
objstream.Charset = "UTF-8" 
'转换原来默认的UTF-8编码转换成GB2312编码，否则直接用XMLHTTP调用有中文字符的网页得到的将是乱码 
bBytesToBstr = objstream.ReadText 
objstream.Close 
set objstream = nothing 
end Function 
Function BytesToBstr(body) 
dim objstream 
set objstream = CreateObject("adodb.stream") 
objstream.Type = 1 
objstream.Mode =3 
objstream.Open 
objstream.Write body 
objstream.Position = 0 
objstream.Type = 2 
objstream.Charset = "UTF-8" 
'转换原来默认的UTF-8编码转换成GB2312编码，否则直接用XMLHTTP调用有中文字符的网页得到的将是乱码 
BytesToBstr = objstream.ReadText 
objstream.Close 
set objstream = nothing 
end Function
%>
